package view;

import Bean.Room;
import control.CustomerManagerControl;
import control.HirePayControl;
import control.RoomManagerControl;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.Date;
import java.util.List;
import javax.swing.JFrame;
import javax.swing.JOptionPane;

public class HireRoomPanel extends RootPanel
{

    HirePayControl hpControl = new HirePayControl();
    RoomManagerControl rmControl = new RoomManagerControl();
    CustomerManagerControl cmControl = new CustomerManagerControl();
    int choice1, choice2;
    String NameCustomer, NameRoom;
    int index;
    //Date date = new Date();

    public HireRoomPanel(JFrame window)
    {
        initComponents();
        this.window = window;
        this.reset();
        jTDanhsachKH.addMouseListener(new MouseAdapter()
        {
            @Override
            public void mousePressed(MouseEvent me)
            {
                index = jTDanhsachKH.getSelectedRow();
                choice1 = (int) jTDanhsachKH.getValueAt(index, 0);
                NameRoom = (String) jTDanhsachKH.getValueAt(index, 1);
                jTFChonKH.setText(NameRoom);
            }
        });
        jTDanhsachphong.addMouseListener(new MouseAdapter()
        {
            @Override
            public void mousePressed(MouseEvent me)
            {
                index = jTDanhsachphong.getSelectedRow();
                choice2 = (int) jTDanhsachphong.getValueAt(index, 0);
                jTFChonphong.setText(Integer.toString(choice2));

            }
        });
        setBgSearch(50, 45);
        setBgSearch(50, 335);
        setBgSelect(555, 95);
        setTime();
        setBackground("rent_panel");
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents()
    {

        jCheckBox3 = new javax.swing.JCheckBox();
        jCheckBox2 = new javax.swing.JCheckBox();
        jCheckBox1 = new javax.swing.JCheckBox();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTDanhsachphong = new javax.swing.JTable();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTDanhsachKH = new javax.swing.JTable();
        jButton1 = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jTFTimkiemKH = new javax.swing.JTextField();
        jButton2 = new javax.swing.JButton();
        jLabel4 = new javax.swing.JLabel();
        jTFTimkiemphong = new javax.swing.JTextField();
        jButton3 = new javax.swing.JButton();
        j1 = new javax.swing.JTextField();
        jProgressBar1 = new javax.swing.JProgressBar();
        jLabel6 = new javax.swing.JLabel();
        jTFChonKH = new javax.swing.JTextField();
        jCBPhone = new javax.swing.JCheckBox();
        jCBCMTND = new javax.swing.JCheckBox();
        jCBTenKH = new javax.swing.JCheckBox();
        jCBTenphong = new javax.swing.JCheckBox();
        jCBTinhtrang = new javax.swing.JCheckBox();
        jCBLoaiphong = new javax.swing.JCheckBox();
        jLabel7 = new javax.swing.JLabel();
        jTFChonphong = new javax.swing.JTextField();
        jCBTinhtrang1 = new javax.swing.JComboBox();
        jCBLoaiphong1 = new javax.swing.JComboBox();
        jLabel8 = new javax.swing.JLabel();

        jCheckBox3.setText("Điện thoại");

        jCheckBox2.setText("CMTND");

        jCheckBox1.setText("Tên");

        jTDanhsachphong.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][]
            {

            },
            new String []
            {

            }
        ));
        jScrollPane1.setViewportView(jTDanhsachphong);

        jTDanhsachKH.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][]
            {

            },
            new String []
            {

            }
        ));
        jScrollPane2.setViewportView(jTDanhsachKH);

        jButton1.setText("Thuê phòng");
        jButton1.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                jButton1ActionPerformed(evt);
            }
        });

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 13)); // NOI18N
        jLabel1.setForeground(new java.awt.Color(0, 51, 153));
        jLabel1.setText("CHỌN KHÁCH HÀNG");

        jLabel2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jLabel2.setForeground(new java.awt.Color(0, 51, 153));
        jLabel2.setText("CHỌN PHÒNG");

        jLabel3.setText("Tìm kiếm theo");

        jButton2.setText("Tìm");
        jButton2.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                jButton2ActionPerformed(evt);
            }
        });

        jLabel4.setText("Tìm kiếm theo ");

        jButton3.setText("Tìm");
        jButton3.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                jButton3ActionPerformed(evt);
            }
        });

        j1.setEditable(false);

        jLabel6.setText("Khách hàng:");

        jTFChonKH.setEditable(false);

        jCBPhone.setText("Điện thoại");
        jCBPhone.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                jCBPhoneActionPerformed(evt);
            }
        });

        jCBCMTND.setText("CMTND");
        jCBCMTND.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                jCBCMTNDActionPerformed(evt);
            }
        });

        jCBTenKH.setText("Tên");
        jCBTenKH.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                jCBTenKHActionPerformed(evt);
            }
        });

        jCBTenphong.setText("Tên");
        jCBTenphong.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                jCBTenphongActionPerformed(evt);
            }
        });

        jCBTinhtrang.setText("Tình trạng");
        jCBTinhtrang.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                jCBTinhtrangActionPerformed(evt);
            }
        });

        jCBLoaiphong.setText("Loại phòng");
        jCBLoaiphong.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                jCBLoaiphongActionPerformed(evt);
            }
        });

        jLabel7.setText("Phòng:");

        jTFChonphong.setEditable(false);

        jCBTinhtrang1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Còn trống", "Đã thuê" }));

        jLabel8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/data/divider.png"))); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(62, 62, 62)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup()
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                            .addComponent(jLabel1)
                                            .addGroup(layout.createSequentialGroup()
                                                .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addGap(11, 11, 11)
                                                .addComponent(jCBTenKH)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(jCBCMTND)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(jCBPhone)))
                                        .addGap(18, 18, 18)
                                        .addComponent(jTFTimkiemKH, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(jButton2))
                                    .addGroup(layout.createSequentialGroup()
                                        .addGap(133, 133, 133)
                                        .addComponent(jLabel8)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 541, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup()
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jLabel6)
                                            .addComponent(jLabel7))
                                        .addGap(18, 18, 18)
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                            .addComponent(jTFChonKH)
                                            .addComponent(jTFChonphong, javax.swing.GroupLayout.PREFERRED_SIZE, 139, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                        .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(41, 41, 41)))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup()
                                        .addGap(239, 239, 239)
                                        .addComponent(jLabel2))
                                    .addGroup(layout.createSequentialGroup()
                                        .addGap(53, 53, 53)
                                        .addComponent(jLabel4)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(jCBTenphong)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jCBTinhtrang)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jCBLoaiphong)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(jTFTimkiemphong, javax.swing.GroupLayout.PREFERRED_SIZE, 136, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jCBTinhtrang1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(2, 2, 2)
                                        .addComponent(jCBLoaiphong1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jButton3))
                                    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 615, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(0, 0, Short.MAX_VALUE))))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(411, 411, 411)
                        .addComponent(j1, javax.swing.GroupLayout.PREFERRED_SIZE, 154, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addComponent(jProgressBar1, javax.swing.GroupLayout.DEFAULT_SIZE, 17, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(j1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jProgressBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel8))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(20, 20, 20)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel4)
                            .addComponent(jCBTenphong)
                            .addComponent(jCBTinhtrang)
                            .addComponent(jCBLoaiphong)
                            .addComponent(jTFTimkiemphong, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jButton3)
                            .addComponent(jCBTinhtrang1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jCBLoaiphong1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(30, 30, 30)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel6)
                                    .addComponent(jTFChonKH, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(18, 18, 18)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jTFChonphong, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel7))
                                .addGap(26, 26, 26)
                                .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(0, 53, Short.MAX_VALUE)))
                .addGap(10, 10, 10)
                .addComponent(jLabel1)
                .addGap(20, 20, 20)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jCBTenKH)
                    .addComponent(jCBCMTND)
                    .addComponent(jCBPhone)
                    .addComponent(jLabel3)
                    .addComponent(jTFTimkiemKH, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton2))
                .addGap(30, 30, 30)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(132, 132, 132))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        // TODO add your handling code here:\
        if (choice1 == 0)
        {
            JOptionPane.showMessageDialog(null, "Chưa chọn khách hàng");
        }
        else
        {
            if (choice2 == 0)
            {
                JOptionPane.showMessageDialog(null, "Chưa chọn phòng");
            }
            else
            {
                if (JOptionPane.showConfirmDialog(this, "Bạn chắc chắn muốn thuê phòng?",
                        "Thuê phòng", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION)
                {
                    hpControl.addHireRoom(choice1, choice2, date);
                    hpControl.changeRoom(choice2, "Đã thuê");
                    JOptionPane.showMessageDialog(null, "Thuê thành công");
                    choice1 = 0;
                    choice2 = 0;
                    this.reset();
                }

            }
        }
    }//GEN-LAST:event_jButton1ActionPerformed

    private void jCBTenKHActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCBTenKHActionPerformed
        // TODO add your handling code here:
        jTFTimkiemKH.setText(null);
        jCBPhone.setSelected(false);
        jCBCMTND.setSelected(false);
    }//GEN-LAST:event_jCBTenKHActionPerformed

    private void jCBCMTNDActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCBCMTNDActionPerformed
        // TODO add your handling code here:
        jTFTimkiemKH.setText(null);
        jCBTenKH.setSelected(false);
        jCBPhone.setSelected(false);

    }//GEN-LAST:event_jCBCMTNDActionPerformed

    private void jCBPhoneActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCBPhoneActionPerformed
        // TODO add your handling code here:
        jTFTimkiemKH.setText(null);
        jCBTenKH.setSelected(false);
        jCBCMTND.setSelected(false);
    }//GEN-LAST:event_jCBPhoneActionPerformed

    private void jCBTenphongActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCBTenphongActionPerformed
        // TODO add your handling code here:

        jCBLoaiphong.setSelected(false);
        jCBTinhtrang.setSelected(false);
        jTFTimkiemphong.setVisible(true);
        jCBLoaiphong1.setVisible(false);
        jCBTinhtrang1.setVisible(false);
    }//GEN-LAST:event_jCBTenphongActionPerformed

    private void jCBTinhtrangActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCBTinhtrangActionPerformed
        // TODO add your handling code here:
        jTFTimkiemphong.setText(null);
        jCBTenphong.setSelected(false);
        jCBLoaiphong.setSelected(false);
        jTFTimkiemphong.setVisible(false);
        jCBLoaiphong1.setVisible(false);
        jCBTinhtrang1.setVisible(true);
    }//GEN-LAST:event_jCBTinhtrangActionPerformed

    private void jCBLoaiphongActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCBLoaiphongActionPerformed
        // TODO add your handling code here:
        jTFTimkiemphong.setText(null);
        jCBTenphong.setSelected(false);
        jCBTinhtrang.setSelected(false);
        jTFTimkiemphong.setVisible(false);
        jCBLoaiphong1.setVisible(true);
        jCBTinhtrang1.setVisible(false);
        jCBLoaiphong1.removeAllItems();
        List<Room> list = rmControl.getRoomTypeName();
        for (Room obj_room : list)
        {
            jCBLoaiphong1.addItem(obj_room.getTyperoom().toString());
        }
    }//GEN-LAST:event_jCBLoaiphongActionPerformed

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        // TODO add your handling code here:
        if (jCBTenKH.getSelectedObjects() != null)
        {
            String key = jTFTimkiemKH.getText();
            jTDanhsachKH.setModel(hpControl.filterNameCustomer(key));
        }
        else
        {
            if (jCBPhone.getSelectedObjects() != null)
            {
                String key = jTFTimkiemKH.getText();
                jTDanhsachKH.setModel(hpControl.filterPhoneCustomer(key));
            }
            else
            {
                String key = jTFTimkiemKH.getText();
                jTDanhsachKH.setModel(hpControl.filterCMTNDCustomer(key));
            }
        }

    }//GEN-LAST:event_jButton2ActionPerformed

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
        if (jCBTenphong.getSelectedObjects() != null)
        {
            String key = jTFTimkiemphong.getText();
            jTDanhsachphong.setModel(hpControl.filterNameRoom(key));
        }
        else
        {
            if (jCBLoaiphong.getSelectedObjects() != null)
            {
                String key = (String) jCBLoaiphong1.getSelectedItem();
                jTDanhsachphong.setModel(hpControl.filterTypeRoom(key));
            }
            else
            {
                String key = (String) jCBTinhtrang1.getSelectedItem();
                jTDanhsachphong.setModel(hpControl.filterStateRoom(key));
            }
        }
        // TODO add your handling code here:

    }//GEN-LAST:event_jButton3ActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField j1;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JCheckBox jCBCMTND;
    private javax.swing.JCheckBox jCBLoaiphong;
    private javax.swing.JComboBox jCBLoaiphong1;
    private javax.swing.JCheckBox jCBPhone;
    private javax.swing.JCheckBox jCBTenKH;
    private javax.swing.JCheckBox jCBTenphong;
    private javax.swing.JCheckBox jCBTinhtrang;
    private javax.swing.JComboBox jCBTinhtrang1;
    private javax.swing.JCheckBox jCheckBox1;
    private javax.swing.JCheckBox jCheckBox2;
    private javax.swing.JCheckBox jCheckBox3;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JProgressBar jProgressBar1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JTable jTDanhsachKH;
    private javax.swing.JTable jTDanhsachphong;
    private javax.swing.JTextField jTFChonKH;
    private javax.swing.JTextField jTFChonphong;
    private javax.swing.JTextField jTFTimkiemKH;
    private javax.swing.JTextField jTFTimkiemphong;
    // End of variables declaration//GEN-END:variables

    private void reset()
    {
        jTDanhsachKH.setModel(hpControl.getAllCustomer());
        jTDanhsachKH.getTableHeader().setReorderingAllowed(false);
        jTDanhsachphong.setModel(hpControl.getAllRoom());
        jTDanhsachphong.getTableHeader().setReorderingAllowed(false);
        jTFChonKH.setText(null);
        jTFChonphong.setText(null);
        jCBTenKH.setSelected(true);
        jCBPhone.setSelected(false);
        jCBCMTND.setSelected(false);
        jCBTenphong.setSelected(true);
        jCBLoaiphong.setSelected(false);
        jCBTinhtrang.setSelected(false);
        jTFTimkiemphong.setVisible(true);
        jCBLoaiphong1.setVisible(false);
        jCBTinhtrang1.setVisible(false);
        jTFTimkiemKH.setText(null);
        jTFTimkiemphong.setText(null);
    }

    @Override
    public void Show()
    {
        super.Show();
        reset();
    }
}